package com.qf.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsOrderMapper;
import com.qf.pojo.DtsOrder;
import com.qf.vo.CategorySellAmts;
import com.qf.vo.DayStatis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sun.dc.pr.PRError;

import java.util.List;
import java.util.Map;

/**
 * projectName: shop-manage
 *
 * @author: 元
 * time: 2021/9/13 0013 19:28
 * description:
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private DtsOrderMapper dtsOrderMapper;
    @Override
    public Integer orderCount() {
        QueryWrapper<DtsOrder> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("deleted",0);
        Integer count = dtsOrderMapper.selectCount(queryWrapper);
        return count;
    }

    @Override
    public List<DayStatis> orderStitis(Integer daysAgo) {
        List<DayStatis> list = dtsOrderMapper.statisIncrOrderCnt(daysAgo);

        return list;
    }

    @Override
    public List<CategorySellAmts> categorySellAmt() {
        List<CategorySellAmts> list = dtsOrderMapper.categorySellStatis();
        return list;
    }

    @Override
    public List<Map> statOrderByday() {
        List<Map> maps = dtsOrderMapper.queryAllOrders();
        return maps;
    }
}
